import Vue from 'vue'
import VueRouter from 'vue-router'
import ArticleDetail from '@/views/ArticleDetail'
import LayOut from '@/views/LayOut.vue'
import NewArticle from '@/views/Article.vue'
import MyCollect from '@/views/Collect.vue'
import AboutMe from '@/views/User.vue'
import MyLike from '@/views/Like.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: LayOut,
    redirect: '/article',
    children: [
      {
        path: '/article',
        component: NewArticle,
        children: [
          {
            path: '/article/detail',
            component: ArticleDetail
          }
        ]
      },
      {
        path: '/collect',
        component: MyCollect
      },
      {
        path: '/user',
        component: AboutMe
      },
      {
        path: '/like',
        component: MyLike
      }
    ]
  },
  {
    path: '/detail/:id',
    component: ArticleDetail
  }
]

const router = new VueRouter({
  routes
})

export default router